﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//using Microsoft.VisualStudio.TestTools.UnitTesting;

//using Pibby.Core.IO;
//using Pibby.Core.Models;
//using Pibby.Core.Persistence;
//using Pibby.Core.ViewModels;

//namespace Pibby.Core.Tests
//{
//    [TestClass]
//    public class PodcastPropertiesModelTests : IntegrationBaseTestFixture
//    {
//        private Podcast _podcast;

//        [TestInitialize]
//        public override void Setup()
//        {
//            base.Setup();

//            this._podcast = Stubs.PodcastFactory.GeneratePodcasts("mypodcast", 1)[0];
//            this.Repository.Put(this._podcast);
//        }

//        [TestMethod]
//        public void Model_FromPodcast_PopulatesProperties()
//        {
//            PodcastPropertiesModel m = new PodcastPropertiesModel(this.Repository, this._podcast);

//            Assert.AreEqual(this._podcast.Name, m.Properties.Name);
//            Assert.AreEqual(this._podcast.Feed, m.Properties.Url);
//            Assert.AreEqual(this._podcast.PublicationDate, m.Properties.PublicationDate);
//            Assert.AreEqual(this._podcast.Description, m.Properties.Description);
//        }

//        [TestMethod]
//        public void Model_FromId_PopulatesProperties()
//        {
//            PodcastPropertiesModel m = new PodcastPropertiesModel(this.Repository, this._podcast.Id);

//            Assert.AreEqual(this._podcast.Name, m.Properties.Name);
//            Assert.AreEqual(this._podcast.Feed, m.Properties.Url);
//            Assert.AreEqual(this._podcast.PublicationDate, m.Properties.PublicationDate);
//            Assert.AreEqual(this._podcast.Description, m.Properties.Description);
//        }


//        [TestMethod]
//        public void Model_UpdateName_SavesChanges()
//        {
//            PodcastPropertiesModel m = new PodcastPropertiesModel(this.Repository, this._podcast.Id);

//            Assert.AreEqual(this._podcast.Name, m.Properties.Name);
//            Assert.AreEqual(this._podcast.Feed, m.Properties.Url);
//            Assert.AreEqual(this._podcast.PublicationDate, m.Properties.PublicationDate);
//            Assert.AreEqual(this._podcast.Description, m.Properties.Description);
//        }

//        [TestMethod]
//        public void Model_UpdateUrl_NameIsUnchanged()
//        {
//            string podcastName = this._podcast.Name;

//            PodcastPropertiesModel m = new PodcastPropertiesModel(this.Repository, this._podcast.Id);
			
//            m.SaveChanges(new NewPodcastEventArgs("http://www.google.co.uk", string.Empty));

//            m.Populate();

//            PodcastPropertiesViewModel vm = m.Properties;

//            Assert.AreEqual(new Uri("http://www.google.co.uk"), vm.Url);
//            Assert.AreEqual(podcastName, vm.Name);
//        }

//        [TestMethod]
//        public void Model_UpdateName_UrlIsUnchanged()
//        {
//            string url = this._podcast.FeedUrl;

//            PodcastPropertiesModel m = new PodcastPropertiesModel(this.Repository, this._podcast.Id);

//            m.SaveChanges(new NewPodcastEventArgs(string.Empty, "A Fantastic New Name"));

//            m.Populate();

//            PodcastPropertiesViewModel vm = m.Properties;

//            Assert.AreEqual(new Uri(url), vm.Url);
//            Assert.AreEqual("A Fantastic New Name", vm.Name);
//        }

//    }
//}
